#pragma once
//============================================================================
// Copyright (C) 2003-2013 Brett R. Jones 
// All Rights Reserved
//
// You may redistribute and/or modify for non commercial and commercial uses 
// provided this copyright notice remains in place and is not modified
//
// This code is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//
// brettjones1900@gmail.com
// http://www.p2panarchy.com
//============================================================================

/*

//PktFindServers flags
#define RC_SYS_PKT_FIND_TC_PLUGIN_RESERVED_TRACKER_FLAG	0x80000000
#define RC_SYS_PKT_FIND_TC_PLUGIN_HAS_NICKNAME				0x40000000		//has nickname
#define RC_SYS_PKT_FIND_TC_PLUGIN_HAS_TC_PLUGIN_NAME			0x20000000		//has group name
#define RC_SYS_PKT_FIND_TC_PLUGIN_HAS_DESC					0x10000000		//has description
#define RC_SYS_PKT_FIND_TC_PLUGIN_HAS_KEY_INFO				0x08000000		//has public encryption key
//#define RC_SYS_PKT_FIND_TC_PLUGIN_IP_NOT_SAME					0x04000000		//ip in packet not the same as ip recieved from

#define RC_SYS_PKT_FIND_TC_PLUGIN_MUST_MATCH_ALL			0x04000000  //if set only return servers that match all services


#define RC_SYS_PKT_FIND_TC_PLUGIN_PHOTO_FILES_AVAIL		0x00000001		
#define RC_SYS_PKT_FIND_TC_PLUGIN_AUDIO_FILES_AVAIL		0x00000002
#define RC_SYS_PKT_FIND_TC_PLUGIN_VIDEO_FILES_AVAIL		0x00000004
#define RC_SYS_PKT_FIND_TC_PLUGIN_PROGRAM_FILES_AVAIL		0x00000008
#define RC_SYS_PKT_FIND_TC_PLUGIN_ARCHIVE_FILES_AVAIL		0x00000010
#define RC_SYS_PKT_FIND_TC_PLUGIN_OTHER_FILES_AVAIL			0x00000020

#define RC_SYS_PKT_FIND_TC_PLUGIN_INSTANT_MSG_AVAIL			0x00000040		
#define RC_SYS_PKT_FIND_TC_PLUGIN_VOICE_AVAIL				0x00000080		
#define RC_SYS_PKT_FIND_TC_PLUGIN_VIDEO_AVAIL				0x00000100		
#define RC_SYS_PKT_FIND_TC_PLUGIN_WEB_PAGE_AVAIL			0x00000200		
#define RC_SYS_PKT_FIND_TC_PLUGIN_WEB_CAM_SERVER_AVAIL		0x00000400		
#define RC_SYS_PKT_FIND_TC_PLUGIN_TEXT_CHAT_ROOM_SERVER_AVAIL	0x00000800		
#define RC_SYS_PKT_FIND_TC_PLUGIN_3D_CHAT_ROOM_SERVER_AVAIL	0x00001000		

//RcSysPktAnnounce defines
#define RC_SYS_PKT_FIND_TC_PLUGIN_MAX_NAME_LEN		15
#define RC_SYS_PKT_FIND_TC_PLUGIN_MAX_KEY_LEN		128 //max length of key in bytes not bits

#pragma pack(push) 
#pragma pack(1)
class RcSysPktFindPlugin
{
public:
	U16	m_u16PktLen;		
	U16	m_u16PktType; //RC_SYS_PKT_TYPE_FIND_NODE
	U16	m_u16Version;
	U32	m_u32Flags;
	U16	m_u16UplinkSpeed;	//speed of uplink to internet  
	U16	m_u16DnlinkSpeed;	//speed of dnlink from internet
	U16  m_u16MatchPluginFlags;
	U16  m_u16OurPluginFlags;
	unsigned char	m_u8MatchType;	// 0x00 = anyone with matching plugin
									// 0x01 = Exactly matching flags
									// 0x02 = Any matching flags

	unsigned char	m_u8Ttl;
	S64			m_s64FileByteCntQuota;
	unsigned char	m_au8Additional[ ((RC_SYS_PKT_FIND_TC_PLUGIN_MAX_NAME_LEN + 1) * 3) ];
	unsigned char * GetKey( void );

	
	//=== constructor/destructor ===//
	RcSysPktFindPlugin()
	{
		m_u16PktLen = (U16)EmptyLen();
		m_u16PktType = RC_SYS_PKT_TYPE_FIND_PLUGIN;
		m_u16Version = 1;
		m_u32Flags = 0;
		m_u16UplinkSpeed = 0;
		m_u16DnlinkSpeed = 0;
		m_u16MatchPluginFlags = 0;
		m_u16OurPluginFlags = 0;
		m_u8MatchType = 0;
		m_u8Ttl = 1;
		m_s64FileByteCntQuota = 0;
	}

	//=== note: allways call  AddNickName then AddDesc then AddPluginName ===//
	void AddNickName( std::string &csName );
	void AddDesc( std::string &csDesc );
	void AddPluginName( std::string &csName );
	void AddKey( unsigned char * pu8Key );//note: first byte of key is the key length in bytes + 1
	void CalcLen( void );//call after all items have been added
	void GetNickName( std::string &csName );
	void GetDesc( std::string &csDesc );
	void GetPluginName( std::string &csName );
	U32 EmptyLen( void ){ return sizeof( RcSysPktFindNode ) - sizeof( m_au8Additional ); }

};
#pragma pack(pop)
*/

